package thread;

public class Demo13 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                System.out.println("这是线程t");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("线程t结束!");
        });

        t.start();

        System.out.println("main线程开始等待");
        t.join();
        System.out.println("main线程结束等待");
    }

}
